package adv5;

import java.util.Calendar;

/**
 学士后结业考试的时间是每月倒数第二个周六上午8点，输出今年的考试时间
 ，用yyyy/MM/dd hh时 的格式输出
 */
public class TestTime {
    public static void main(String[] args) {
        Calendar c = Calendar.getInstance();
        //System.out.println("今天是周："+c.get(Calendar.DAY_OF_WEEK));
        for (int i = 0; i < 12; i++) {
            c.set(c.get(Calendar.YEAR),i,1);
            //getActualMaximum获得当前时间域的最大值
            c.set(Calendar.DAY_OF_MONTH,c.getActualMaximum(Calendar.DAY_OF_MONTH));

            int week = c.get(Calendar.DAY_OF_WEEK);
            if(week!=Calendar.SATURDAY){
                c.add(Calendar.DATE,-(week));
            }
            c.add(Calendar.DATE,-7);
            System.out.println(">>>"+c.getTime());
        }
    }
}
